
@extends('admin.base')
@section('content')

 <div class="layui-card">
    <blockquote class="layui-elem-quote form-inline layui-form">
        <form action="{{route('admin.goods_list')}}" method="get">
            <div class="layui-inline" style="margin: 3px 0;">
                <div class="layui-input-inline">
                    <input type="text" id="search_keywords" class="layui-input" name="search_keywords" placeholder="搜索商品ID / 商品源ID/ 商品名称" style="width: 80vw" value="{{$search_keywords}}">
                </div>
            </div>
            <div class="layui-inline" style="margin: 3px 0;">
                <button id="searchBtn1" type="submit" class="layui-btn"  style="height: 36px;line-height: 36px;">搜索</button>
            </div>
        </form>
    </blockquote>
    <table cellpadding="0" cellspacing="0"  style="width: 100%;text-align: left" id="list">
        <tr style="border-bottom:1px solid #000">
            <th>商品ID</th>
            <th style="padding: 10px">商品图片</th>
            <th>商品名称</th>
            <th>操作</th>
        </tr>
        @if(count($goods)==0)
            <tr><td style="text-align: center;font-size: 20px">没有数据显示</td></tr>
        @endif
    @foreach ($goods as $value)
        <tr style="border-bottom:1px solid #000">
            <td> &nbsp;&nbsp; {{ $value->id }}</td>
            <td style="padding: 10px">
                <a href="{{ $value->pic_url }}" target="_blank"><img src="{{ $value->pic_url }}" style="max-width:100px;max-height:100px;"/></a>
            </td>
            <td> {{ $value->goods_name }}</td>
            <td><button class="layui-btn" data-id="{{ $value->id }}">选择</button></td>
        </tr>

    @endforeach
    </table>
</div>

{{  $goods->links()   }}
@endsection
@section('script')
    <script type="text/javascript">
        $('#list button').click(function () {
            window.parent.$('#hit_content').val($(this).attr('data-id'));
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭
        })
    </script>
@endsection